package com.sl.au.service;

import com.sl.au.entity.EventRegister;
import com.sl.au.entity.EventReport;
import com.sl.au.entity.ViewForEventReportTask;
import com.sl.au.entity.User;
import com.sl.au.entity.EventTask;
import com.sl.au.entity.EventType;
import com.sl.au.entity.Option;
import com.sl.au.repository.EventReportRepository;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort.Direction;

public interface EventReportService extends BaseService {

	EventReportRepository getRepository();

	List<EventReport> getPage(int start, int length, String key, String orderName, Direction dir);

	int getCount(String key);

	void saveAll(EventReport eventReport, List<EventRegister> list, EventTask eventReportTask,
			List<EventTask> eventRegisterTask);

	List<EventReport> getPageByEventVariable(int start, int length, String key, String eventVariable, String orderName, Direction dir);

	List<ViewForEventReportTask> getViewForEventReportTaskPageByEventVariable(int start, int length, String key,
			String eventVariable, String orderName, Direction dir);

	int getCountByEventVariable(String key, String eventVariable);

	int getViewForEventReportTaskCountByEventVariable(String key, String eventVariable);

	void finishEventReport(String id, String finishMemo, String reportEventAttrVariable, User user);

	List<EventReport> getFinishedReportPageByKey(int start, int length, String key, String optionId);

	List<EventReport> getFinishedReportPageNoKey(int start, int length, String optionId);

	int getFinishedReportCount(String key, String optionId);

	List<EventReport> getEventReportByUser(int start, int length, User user, String orderName, Direction dir);

	List<EventTask> findProcedures(String reportId);

	List<EventReport> getEventReportByEventVariable(String eventVariable);

	int getWaitingAcceptEventCountByAccount(String aid);

	List<EventReport> getReportPageByUserAndType(int start, int length, String user, String type, String orderName,
			Direction dir);

	List<EventReport> getReportPageByUserAndTypes(int start, int length, String user, String[] types, String orderName,
			Direction dir);

	List<ViewForEventReportTask> getReportByGrid(String gridId, String type, Date begin, Date end);

	Map<String, Object> getReportDataByGrid(String gridId, String type, Date begin, Date end);

	Map<String, Object> getStatistics();

	List<EventReport> findInitedInfo(String id, double latitude, double longitude, EventType eventType);

	List<EventReport> findInitedInfo(int start, int length, String id, double latitude, double longitude,
			EventType eventType, String addr);

	int findInitedInfoCount(String id, double latitude, double longitude, EventType eventType, String addr);


	List<Map<String, Object>> getPageByEventVariableAndRole(int start, int length, String roleId, String key, String eventVariable, String orderName, String dir);
	
	int getCountByEventVariableAndRole(String roleId, String key, String eventVariable);
	
	List<Map<String, Object>> getViewForEventReportTaskPageByEventVariableAndRole(int start, int length, String roleId, String key, String eventVariable, String orderName, String dir);
	
	int getViewForEventReportTaskCountByEventVariableAndRole(String roleId, String key, String eventVariable);
	
	List<Map<String, Object>> getFinishedReportPageByKeyAndRole(int start, int length, String roleId, String key, String optionId, String orderName, String dir);
	
	int getFinishedReportCountByRole(String roleId, String key, String optionId);
	
	int getWaitingAcceptEventCountByAccountByRole(String roleId,String aid);
	
	List<EventReport> getPageByEventDate(int start, int length, Date begin, Date end, String orderName, Direction dir);
	
	int getCountByEventDate(Date begin, Date end);
}
